home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / samba.idb / usr / samba / bin / smbprint.z / smbprint
Encoding:
Text File  |  1998-10-28  |  1.7 KB  |  55 lines

  1. #!/bin/sh
  2. #
  3. # @(#) smbprint.sysv version 1.0 Ross Wakelin <r.wakelin@march.co.uk>
  4. #
  5. #      Version 1.0 13 January 1995
  6. #        modified from the original smbprint (bsd) script
  7. #
  8. # this script is a System 5 printer interface script. It uses the smbclient 
  9. # program to print the file to the specified smb-based server and service. 
  10. # To add this to your lp system, modify the server and service variables 
  11. # and then execute the following command (as root):
  12. #
  13. #      lpadmin -punixprintername -v/dev/null -i/usr/samba/bin/smbprint 
  14. # where    unixprintername is the name that the printer will be known as 
  15. # on your unix box. 
  16. # the script smbprint will be copied into your printer administration 
  17. # directory (/usr/spool/lp) as a new interface (interface/unixprintername)
  18. # Then you have to execute the following commands:
  19. #
  20. #      enable unixprintername
  21. #      accept unixprintername
  22. #
  23. # This script will then be called by the lp service to print the files.
  24. # This script will have 6 or more parameters passed to it by the lp service.
  25. # The first five will contain details of the print job, who queued it etc,
  26. # while parameters 6 onwards are a list of files to print.  We just
  27. # cat these to the samba client.
  28. #
  29. # clear out the unwanted parameters
  30.  
  31. shift;shift;shift;shift;shift
  32.  
  33. # now the argument list is just the files to print
  34.  
  35. # Set these to the server and service you wish to print to 
  36. # In this example I have a PC called "admin" that has a printer 
  37. # exported called "hplj2" with no password.
  38. #
  39. server=admin
  40. service=hplj2
  41. password=""
  42.  
  43. # NOTE: The line `echo translate' provides automatic CR/LF translation 
  44. # when printing.
  45. (
  46.     echo translate
  47.     echo "print -"
  48.     cat $*
  49. ) | /usr/samba/bin/smbclient "\\\\$server\\$service" $password -N -P  > /dev/null
  50. exit $?
  51.  
  52.